﻿var theme_typeList = {
    gridDefine: {
        toolbar: { items: [{ text: lang.add, click: function () { openPage("themeTypeEdit", "", "", lang.add); }, icon: 'add'}] },
        columns: [
            {display: 'id', name: 'SUBJ_CLASS_ID', minWidth: 90 },
            { display: lang.SUBJ_CLASS_NAME , name: 'SUBJ_CLASS_NAME', minWidth: 80 },

            { display: lang.operation, name: 'DICTTYPE_ID2', minWidth: 205, render: LinkOP, align: 'center' }

        ],
        url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        urlType: "getThemeClass"
    },
    init: function () {
        jsPageRender(this, true);
    },
    search: function () {
        jsPageSearch(this);
    }

};
function LinkOP(value, row, index) {
    var _str = 'themetypeid=' + row.SUBJ_CLASS_ID;
    return '<span style="padding-right:15px;padding-left:15px;"><a href="javascript:void(0)" onclick="openPage(\'themeTypeEdit\',\'' + _str + '\');">' + lang.edit + '</a></span><span><a href="javascript:void(0)" onclick="deleteThemeType(\'' + row.SUBJ_CLASS_ID + '\',\'' + row.SUBJ_CLASS_NAME + '\');">' + lang.delete_ + '</a> </span>  <span style="padding-right:15px;"><a href="javascript:void(0)" onclick="openPage(\'themeselect\',\'' + _str + '\');">' + lang.select_theme + '</a></span>';
}

function deleteThemeType(dicttypeid, SUBJ_CLASS_NAME) {
    $.extend($.messager.defaults, {
        ok: lang.ok,
        cancel: lang.cancel
    });
    $.confirm(lang.sure_to_delete_the_current_theme + "[" + SUBJ_CLASS_NAME + "]", lang.delete_type, function (b) {
        if (b) {
            $.ajaxHandler({
                url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
                urlType: "deleteThemeType",
                model: function () { return $.toJSON({ 'action': 0, 'SUBJ_CLASS_ID': dicttypeid }); },
                success: function (data) {
                    $.alert(lang.Successfully_deleted, null, function () { theme_typeList.search(); });
                }
            });
        }
    });
}

